package com.epam.weblibrary.controllers;


import com.epam.weblibrary.entities.user.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Iurii_Miedviediev on 9/10/2014.
 */
@Controller
public class HomeController {

    @RequestMapping(value = "/")
     public String getHomePage(@AuthenticationPrincipal User user) {
        if(user != null) {
            return "redirect:books/1";
        }
        return "index";
    }
}
